txId: tx_id

};

sudo node invoke.js

When WAGON10 is created here, we will complete the transaction.

7 . To verify the changes made execute a query. To query WAGON10,

change q uery.js using the q ueryWagon function:

var request = {

chaincodeId: 'wagon',

fcn: 'queryWagon',

args: ['WAGON10'],

chainId: 'mychannel',

txId: tx_id

8. Run q uery.js again. We can now extract WAGON10 from the ledger

with the response as.

{"color":"Red","docType":"wagon","make":"Chevy","model":"Vol

t","owner":"Vicky"}:

sudo node query.js

This will result in the following query:

9 . Shut down the Fabric network:

sudo docker stop $(sudo docker ps -a -q) sudo docker rm

$(sudo docker ps -a -q) sudo docker ps

U sing smart contract chaincode to query and update the transaction are the

steps. Let us now see how it works.

Putting things together

To create and deploy your smart contract chaincode this is the conclusion.

We used query.j s to query the key-value pair store in the previous steps. We

can perform complex searches on J SON data-storage formats and query for the

values of one or more keys. The working of the query is shown in the

following figure: